package com.way.filemanager.providers;

import android.os.Environment;
import android.util.Log;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class IgnoreDirectory {
    static List <String>IgnoreDirPathMap = new ArrayList<String>();
    static List <String>IgnoreDirNameMap = new ArrayList<String>();
    static {
        IgnoreDirPathMap.add(Environment.getExternalStorageDirectory()+"/android/data/");


        IgnoreDirNameMap.add("cache");
        IgnoreDirNameMap.add("mtklog");
    }

    public static boolean isNeedIgnore(File f)
    {
        //boolean ret = f.isDirectory();
        boolean isHide = !(f.getPath().indexOf("/.") == -1);//IsHide
        if(isHide)
            return true;
        for(String ignorepath:IgnoreDirPathMap)
        {
            if(ignorepath.equalsIgnoreCase(f.getPath()))
            {
                return true;
            }
        }
        for(String ignoreName:IgnoreDirNameMap)
        {
            if(ignoreName.equalsIgnoreCase(f.getName()))
            {
                return true;
            }
        }
        return false;
    }
}
